//-----------------------------------------------------------------------
//<copyright file="KhachHangBLL.cs
//Code gen by tool.
//</copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using PMS.DAL;
using PMS.Entity;
using PMS.Exceptions;

namespace PMS.BLL
{
	public class KhachHangBO : BaseBO
	{
		// Interface Instant Object
		private readonly IKhachHangDAO khachhangInterfaceObject = null;

		// Constructor
		public KhachHangBO()
		{
			khachhangInterfaceObject = new DAL.ServiceFactory<IKhachHangDAO>().CurrentDAL;
		}

		#region KhachHang

		/// <summary>
		///
		/// </summary>
		/// <param name="khachhang"></param>
		public KhachHang CreateKhachHang(KhachHang khachhang)
		{
			try
			{
				return khachhangInterfaceObject.CreateKhachHang(khachhang);
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access CreateKhachHang Exception", ex);
			}
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="khachhang"></param>
		public void UpdateKhachHang(KhachHang khachhang)
		{
			try
			{
				khachhangInterfaceObject.UpdateKhachHang(khachhang);
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access UpdateKhachHangException", ex);
			}
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="khachhang"></param>
		public void DeleteKhachHang(KhachHang khachhang)
		{
			try
			{
				khachhangInterfaceObject.DeleteKhachHang(khachhang);
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access DeleteKhachHangException", ex);
			}
		}

		/// <summary>
		///
		/// </summary>
		public KhachHangs GetAllKhachHang()
		{
			try
			{
				return khachhangInterfaceObject.GetAllKhachHang();
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access GetAllKhachHang Exception", ex);
			}
		}

		/// <summary>
		///
		/// </summary>
		/// <param name="maKH"></param>
		public KhachHang GetKhachHangByID(string maKH)
		{
			try
			{
				return khachhangInterfaceObject.GetKhachHangByID(maKH);
			}
			catch (Exception ex)
			{
				throw BusinessException.GetException("Business Access GetKhachHangBy ID Exception", ex);
			}
		}

		#endregion
	}
}
